#include<iostream>
#include<cstdio>
using namespace std;
long long n,a[200001],ans,j,i,numa,numb;
bool f[200001],k;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%lld",&n);
	for(i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		if(a[i]==1)numa++;
		else numb++;
	}
	numa=min(numa,numb);
	i=1;
	ans=n;
	while(ans){
		if(i>n){
			printf("\n");
			i=1;
		}
		if((n-ans)/2>=numa){
			for(i=1;i<=n;i++){
				if(!f[i])printf("%lld\n",i);
			}
			break;
		}
		if(!f[i]&&a[i]!=a[j]){
			printf("%lld ",i);
			j=i;
			ans--;
			f[i]=true;
		}
		i++;
	}
}
